<template>
  <el-dialog
    width="30%"
    title="修改入住项目"
    :visible.sync="innerVisible"
    append-to-body
    destroy-on-close

  >

    <el-form ref="list"    :model="list"    label="top">
      <el-form-item label="套餐项目名称" prop="dailyNumberOfCare"  >

        <span>
              {{list.itemName}}
        </span>

      </el-form-item>

      <el-form-item label="套餐项目日护理次数" required>
        <el-input v-model.number="list.dailyNumberOfCare"    type="number" min="1"></el-input>


      </el-form-item>

      <el-form-item label="套餐项目月护理次数"   required>
        <el-input v-model.number="list.monthNumberOfCare"    type="number" min="1"></el-input>

      </el-form-item>
      <el-form-item label="套餐项目总护理次数"  required>
        <el-input v-model.number="list.totalNumberOfCare"   type="number" min="1"></el-input>
      </el-form-item>



    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="innerVisible = false">取 消</el-button>
      <el-button type="primary" @click="save">保存</el-button>
    </div>
  </el-dialog>
</template>

<script>
    import { searchtcinfo } from "@/api/moveset"
    import { resvise} from "@/api/revisetc"
    export default {
        name: "revisetc",
        data(){
            return{
                innerVisible:false,
                value:"",
                list:
                     {
                        dailyNumberOfCare:'',
                        monthNumberOfCare:"",
                        totalNumberOfCare:"",
                        itemMark:"",
                        itemName:"",
                        checkInMark:"",
                    },

                rules:{
                    dailyNumberOfCare: [{ required: true, trigger: "blur", message: "套餐项目日护理次数" ,type:'number'}],
                    monthNumberOfCare:[{ required: true, message: "套餐项目月护理次数", trigger: "blur",type:'number'}],
                    totalNumberOfCare:[{ required: true, message: "套餐项目总护理次数",trigger: "blur",type:'number'}],


                },
                options: [

                ],
            }
        },
        methods:{
            showEdit(row) {
                this.innerVisible = true;
                console.log(row)
                this.list.itemName=row.itemName
                this.list.itemMark=row.itemMark
                this.list.checkInMark=row.checkInMark
                this.list.dailyNumberOfCare=row.dailyNumberOfCare
                this.list.monthNumberOfCare=row.monthNumberOfCare
                this.list.totalNumberOfCare=row.totalNumberOfCare
            },
            save(){

                resvise(this.list).then(res => {
                    console.log(res)
                    if(res.code==200){
                        this.$message({
                            message: "修改成功",
                            type: 'success'
                        })
                        this.innerVisible=false
                        let   checkInMark= this.list.checkInMark
                        searchtcinfo({checkInMark}).then(res => {

                            this.$parent.tcinfo=res.data
                            for(var i=0;i<res.data.items.length;i++){
                                res.data.items[i].dailyFee=res.data.dailyFee
                                res.data.items[i].monthFee=res.data.monthFee
                                res.data.items[i].name=res.data.name
                            }
                            this.$parent.getRowSpan()



                        })
                    }



                })
                console.log(this.list);
            },

        }
    }
</script>

<style scoped>

</style>
